package demo.controller.form;

import demo.enums.TypeEnum;
import demo.swagger.ApiModelEnumProperty;
import demo.validation.annotation.EnumValue;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @author meilin.huang
 * @date 2022-02-16 5:57 PM
 */
@Data
public class NewTestForm {

    @ApiModelProperty("主键")
    private Long id;

    @ApiModelEnumProperty(value = "Integer类型", enumClass = TypeEnum.class)
    @EnumValue(value = TypeEnum.class, name = "类型1") // 限制type只能为TypeEnum中对应的枚举值即 1,2,3
    private Integer type;

    @ApiModelEnumProperty(value = "Enum类型", enumClass = TypeEnum.class, values = {"T1", "T2"})
    @EnumValue(values = {"T1", "T2"})  // 限制typeEnum只允许传递T1和T2枚举类实例对象名
    private TypeEnum typeEnum;

    @ApiModelEnumProperty(value = "限制指定枚举值类型", enumClass = TypeEnum.class, values = {"1", "3"})
    @EnumValue(value = TypeEnum.class, values = {"1", "3"}) // 限制type2只允许为TypeEnum中对应的枚举值1,3
    private Integer type2;

    @EnumValue(values = {"1", "2"}, name = "状态")  // 状态只能传 1,2
    private Integer status;
}
